<%@ page contentType="application/json; charset=utf-8" %>

<%
	int statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
	String message = (String) request.getAttribute("javax.servlet.error.message");
	String servletName = (String) request.getAttribute("javax.servlet.error.servlet_name");
	String uri = (String) request.getAttribute("javax.servlet.error.request_uri");
	Throwable t = (Throwable) request.getAttribute("javax.servlet.error.exception");
	Class exception = (Class) request.getAttribute("javax.servlet.error.exception_type");
	
	String msgContent = "";
	
	if (statusCode == 404) {
	msgContent = "指示请求的资源不在服务器上(NotFound)";
} else if (statusCode == 500) {
	msgContent = "服务器发生了内部错误(InternalServerError)";
} else if (statusCode == 400) {
	msgContent = "服务器未能识别请求(BadRequest)";
} else if (statusCode == 405) {
	msgContent = "请求的资源上不允许请求方法(POST或GET，MethodNotAllowed)";
} else if (statusCode == 406) {
	msgContent = "不接受资源的任何可用表示形式(NotAcceptable 客户端已用 Accept头)";
} else if (statusCode == 415) {
	msgContent = "请求是不支持的类型(UnsupportedMediaType)";
} else if (statusCode == 401) {
	msgContent = "请求的资源要求身份验证(Unauthorized)";
} else if (statusCode == 402) {
	msgContent = "保留PaymentRequired以供将来使用";
} else if (statusCode == 403) {
	msgContent = "服务器拒绝满足请求(Forbidden)";
} else if (statusCode == 407) {
	msgContent = "请求的代理要求身份验证(ProxyAuthenticationRequired)";
} else if (statusCode == 408) {
	msgContent = "客户端没有在服务器期望请求的时间内发送请求(RequestTimeout)";
} else if (statusCode == 409) {
	msgContent = "由于服务器上的冲突而未能执行请求(Conflict)";
} else if (statusCode == 410) {
	msgContent = "请求的资源不再可用(Gone)";
} else if (statusCode == 411) {
	msgContent = "缺少必需的 Content-length头(LengthRequired)";
} else if (statusCode == 412) {
	msgContent = "为此请求设置的条件失败,且无法执行此请求.条件是用条件请求标头（如 If-Match、If-None-Match 或 If-Unmodified-Since）设置的(PreconditionFailed)";
} else if (statusCode == 413) {
	msgContent = "请求太大,服务器无法处理(RequestEntityTooLarge)";
} else if (statusCode == 414) {
	msgContent = "URI太长(RequestUriTooLong)";
} else if (statusCode == 416) {
	msgContent = "无法返回从资源请求的数据范围，因为范围的开头在资源的开头之前，或因为范围的结尾在资源的结尾之后(RequestedRangeNotSatisfiable)";
} else if (statusCode == 417) {
	msgContent = "服务器未能符合 Expect头中给定的预期值(ExpectationFailed)";
} else if (statusCode == 501) {
	msgContent = "服务器不支持请求的函数(NotImplemented)";
} else if (statusCode == 502) {
	msgContent = "中间代理服务器从另一代理或原始服务器接收到错误响应(BadGateway)";
} else if (statusCode == 503) {
	msgContent = "服务器暂时不可用，通常是由于过多加载或维护(ServiceUnavailable)";
} else if (statusCode == 504) {
	msgContent = "中间代理服务器在等待来自另一个代理或原始服务器的响应时已超时(GatewayTimeout)";
} else if (statusCode == 505) {
	msgContent = "服务器不支持请求的 HTTP版本(HttpVersionNotSupported)";
}
%>

{"command":"<%=uri%>","result":"0","body":{"status":"0","msg":{"code":"<%=statusCode%>","content":"<%=msgContent%>"}}}